fstats_mcmc Module



Interfaces

interface

  • public subroutine evaluate_model(this, xdata, xc, y)

    Evaluates the model at the supplied values.

    Arguments

    Type IntentOptional Attributes Name
    class(mcmc_target), intent(in) :: this

    The mcmc_target object.

    real(kind=real64), intent(in), dimension(:) :: xdata

    An M-element array containing the values at which to evaluate the model.

    real(kind=real64), intent(in), dimension(:) :: xc

    An N-element array containing the model parameters.

    real(kind=real64), intent(out), dimension(:) :: y

    An M-element array where the resulting model values wil be written.


Derived Types

type, public ::  chain_builder

A type allowing for the construction of chain of values.

Type-Bound Procedures

procedure, public :: get_chain => cb_get_chain
procedure, public :: get_chain_length => cb_get_chain_length
procedure, public :: get_state_variable_count => cb_get_nvars
procedure, public :: push_new_state => cb_push
procedure, public :: reset => cb_clear_chain

type, public ::  mcmc_proposal

Defines a type responsible for generating a proposal state for a Monte-Carlo, Markov-Chain sampler.

Type-Bound Procedures

procedure, public :: generate_sample => mp_gen
procedure, public :: get_recenter => mp_get_recenter
procedure, public :: set_recenter => mp_set_recenter

type, public, extends(chain_builder) ::  mcmc_sampler

An implementation of the Metropolis-Hastings algorithm for the generation of a Markov chain.

Type-Bound Procedures

procedure, public :: get_accepted_count => ms_get_num_accepted
procedure, public :: get_chain => cb_get_chain
procedure, public :: get_chain_length => cb_get_chain_length
procedure, public :: get_state_variable_count => cb_get_nvars
procedure, public :: on_acceptance => ms_on_success
procedure, public :: on_rejection => ms_on_rejection
procedure, public :: push_new_state => cb_push
procedure, public :: reset => cb_clear_chain
procedure, public :: sample => ms_sample

type, public ::  mcmc_target

Defines a model of the target distribution(s). This type is key to the MCMC regression process. The approach taken is to evaluate the model provided here and evaluating its likelihood. The likelihood is evaluated by computing the residual between the model and data, and making the assumption that the residual should be normally distributed.

Read more…

Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: data_noise = 1.0d0

A parameter representing the noise in the data.

Type-Bound Procedures

procedure, public :: add_parameter => mt_add_param
procedure, public :: evaluate_prior => mt_eval_prior
procedure, public :: evaluate_variance_prior => mt_eval_var_prior
procedure, public :: get_parameter => mt_get_param
procedure, public :: get_parameter_count => mt_get_param_count
procedure, public :: likelihood => mt_likelihood
procedure(evaluate_model), public, deferred :: model
procedure, public :: sample_variance_prior => mt_sample_var_prior